package com.playball.lottery.customview;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import android.util.Log;

/**
 * 竞彩足球混合投注玩法奖金预测计算注数，最小最大奖金相关工具类
 * 
 * @author Administrator
 * 
 */
public class JczqHHMoneyForecastUtil {

	/**
	 * 获取一列中最大sp值集合,分别取各玩法最大sp组成一个list
	 * 
	 * @param selectsp="spf,1.48/rq,1.65/rq,1.75/bf,4.50/bf,8.50/"; 
	 * @return  [1.48, 1.75, 8.5]
	 */
	public static List<String> getTeamMaxSPList(String selectsp) {
//		Log.d("getTeamMaxSP", "selectsp= " + selectsp.toString());
		List<String> listAll = new ArrayList<String>();
		if(!selectsp.equals("")){
		// "1.50,1.80," selectsp
		if(selectsp.length()>=1){
			selectsp = selectsp.substring(0, selectsp.length() - 1);
		}
		String[] strs = selectsp.split("/");//dxf1,1.70
		
		List<String> listSpf = new ArrayList<String>();
		List<String> listRqspf = new ArrayList<String>();
		List<String> listZjq = new ArrayList<String>();
		List<String> listBqc = new ArrayList<String>();
		List<String> listBf = new ArrayList<String>();
		for(int i=0;i<strs.length;i++){
			if(strs[i].contains("spf")){
				listSpf.add(strs[i]);
			}
			if(strs[i].contains("rq")){
				listRqspf.add(strs[i]);
			}
			if(strs[i].contains("zjq")){
				listZjq.add(strs[i]);
			}
			if(strs[i].contains("bqc")){
				listBqc.add(strs[i]);
			}
			if(strs[i].contains("bf")){
				listBf.add(strs[i]);
			}
		}
		
//		System.out.println("listSpf= " + listSpf.toString());
//		System.out.println("listRqspf= " + listRqspf.toString());
//		System.out.println("listZjq= " + listZjq.toString());
//		System.out.println("listBqc= " + listBqc.toString());
//		System.out.println("listBf= " + listBf.toString());
		
		if(listSpf.size()!=0){
			List<Float> listSpfF = new ArrayList<Float>();
			for (int k = 0; k < listSpf.size(); k++) {
				listSpfF.add(Float.parseFloat(listSpf.get(k).split(",")[1]));
			}
			
			float spfmax = Collections.max(listSpfF);
//			System.out.println("spfmax= " + spfmax);
			String max = String.valueOf(spfmax);
			listAll.add(max);
		}
		
		if(listRqspf.size()!=0){
			List<Float> listRqspfF = new ArrayList<Float>();
			for (int k = 0; k < listRqspf.size(); k++) {
				listRqspfF.add(Float.parseFloat(listRqspf.get(k).split(",")[1]));
			}
			
			float rqspfmax = Collections.max(listRqspfF);
//			System.out.println("rqspfmax= " + rqspfmax);
			String max = String.valueOf(rqspfmax);
			listAll.add(max);
		}
		
		if(listZjq.size()!=0){
			List<Float> listZjqF = new ArrayList<Float>();
			for (int k = 0; k < listZjq.size(); k++) {
				listZjqF.add(Float.parseFloat(listZjq.get(k).split(",")[1]));
			}
			
			float zjqmax = Collections.max(listZjqF);
//			System.out.println("zjqmax= " + zjqmax);
			String max = String.valueOf(zjqmax);
			listAll.add(max);
		}
		
		if(listBqc.size()!=0){
			List<Float> listBqcF = new ArrayList<Float>();
			for (int k = 0; k < listBqc.size(); k++) {
				listBqcF.add(Float.parseFloat(listBqc.get(k).split(",")[1]));
			}
			
			float bqcmax = Collections.max(listBqcF);
//			System.out.println("bqcmax= " + bqcmax);
			String max = String.valueOf(bqcmax);
			listAll.add(max);
		}
		
		if(listBf.size()!=0){
			List<Float> listBfF = new ArrayList<Float>();
			for (int k = 0; k < listBf.size(); k++) {
				listBfF.add(Float.parseFloat(listBf.get(k).split(",")[1]));
			}
			
			float bfmax = Collections.max(listBfF);
//			System.out.println("bfmax= " + bfmax);
			String max = String.valueOf(bfmax);
			listAll.add(max);
		}
//		System.out.println("listAll= " + listAll.toString());
		}
		return listAll;
	}
	
//	/**
//	 * 获取一列中最大sp值
//	 * 
//	 * @param sp
//	 * @return
//	 */
//	public static String getTeamMaxSP(String selectsp) {
//		Log.d("getTeamMaxSP", "selectsp= " + selectsp.toString());
//		String str_sp0 = selectsp.substring(0, selectsp.length() - 1);
//		String[] strs = str_sp0.split("/");
//		List<Float> listf = new ArrayList<Float>();
//		for (int k = 0; k < strs.length; k++) {
//			listf.add(Float.parseFloat(strs[k].split(",")[1]));
//		}
//		Log.v("getTeamMaxSP", "listf= " + listf.toString());
//		float fmax = Collections.max(listf);
//		System.out.println("fmax= " + fmax);
//		String max = String.valueOf(fmax);
//		return max;
//	}

	/**
	 * 获取一列中最小sp值
	 * 
	 * @param selectsp=dxf1,1.70/sfc1,6.50/
	 * @return
	 */
	public static String getTeamMinSP(String selectsp) {
//		Log.d("getTeamMinSP", "selectsp= " + selectsp.toString());
		String min="";
		if(!selectsp.equals("")){
			// "1.50,1.80," selectsp
			if(selectsp.length()>=1){
				selectsp = selectsp.substring(0, selectsp.length() - 1);
			}
			String[] strs = selectsp.split("/");
			List<Float> listf = new ArrayList<Float>();
			for (int k = 0; k < strs.length; k++) {
				listf.add(Float.parseFloat(strs[k].split(",")[1]));
			}
//			Log.v("getTeamMinSP", "listf= " + listf.toString());
			float fmin = Collections.min(listf);
//			System.out.println("fmin= " + fmin);
			min = String.valueOf(fmin);
		}
		return min;
	}

	/**
	 * 获取一列中注数
	 * 
	 * @param sp=sf1,1.48/rfsf1,1.65/rfsf0,1.75/sfc0,4.50/    
	 * @return
	 */
	public static int getTeamCount(String sp) {
//		Log.d("getTeamCount", "sp= " + sp.toString());
		int c = 0;
		// sp //"1.50,1.80,"
		if (sp != null) {
			String str_sp0 = sp.substring(0, sp.length() - 1);
			String[] strs = str_sp0.split("/");
			c = strs.length;
		}
		return c;
	}

	/**
	 * 计算注数，最小奖金，最大奖金
	 * 
	 * @param num
	 * @param list
	 * @return 注数|最小奖金|最大奖金
	 */
	public static String getMatchCount(int num, List<ChildDTO> list) {
//		 for (ChildDTO child : list) {
//		 String jc_mid = child.getmId();
//		 String str_hteam = child.gethTeam();
//		 String str_vteam = child.getvTeam();
//		  String Hhtz1 = child.getHhtz1();
//		  String Hhtz2 = child.getHhtz2();
//		String Hhtz3 = child.getHhtz3();
//		String Hhtz4 = child.getHhtz4();
//		String Hhtz5 = child.getHhtz5();
//		Log.d("JclqHHMoneyForecastUtil", "getMatchCount Hhtz1=" + Hhtz1);
//		Log.d("JclqHHMoneyForecastUtil", "getMatchCount Hhtz2=" + Hhtz2);
//		Log.d("JclqHHMoneyForecastUtil","getMatchCount Hhtz3=" + Hhtz3);
//		Log.d("JclqHHMoneyForecastUtil","getMatchCount Hhtz4=" + Hhtz4);
//		 Log.d("JclqHHMoneyForecastUtil", "getMatchCount jc_mid=" +
//		 jc_mid);
//		 Log.d("JclqHHMoneyForecastUtil", "getMatchCount str_hteam=" +
//		 str_hteam);
//		 Log.d("JclqHHMoneyForecastUtil", "getMatchCount str_vteam=" +
//		 str_vteam);
//		 String Str_sp = child.lqhhtzsp;
//		 Log.d("JclqHHMoneyForecastUtil", "getMatchCount Str_sp=" +
//				 Str_sp);
//		 }
//		Log.d("JclqHHMoneyForecastUtil", "getMatchCount list.size()= " + list.size());
		String result;
		long c = 0;
		BigDecimal bdmaxM = new BigDecimal("0");
		BigDecimal bdminM = new BigDecimal("0");
		if (num == 2) {
			boolean isFirst = true;
			for (int i = 0; i < list.size(); ++i) {
				ChildDTO child = new ChildDTO();
				child = list.get(i);
				//此处sp值根据不同玩法不同，拿取sp值变量不一样
				int num1 = getTeamCount(child.zqhhtzsp);
				List<String> liststr1 = new ArrayList<String>();
				liststr1=getTeamMaxSPList(child.zqhhtzsp);
				BigDecimal bda1= new BigDecimal("0");;
//				if(onlyHasSPFRQSPF){
//					bda1 = new BigDecimal(getTeamMaxSP(child.zqhhtzsp));
//				}			
				BigDecimal bdi1 = new BigDecimal(getTeamMinSP(child.zqhhtzsp));
//				Log.e("getMatchCount", "----bda1= " + bda1);
//				Log.e("getMatchCount", "----bdi1= " + bdi1);
				for (int j = i + 1; j < list.size(); ++j) {
					ChildDTO child2 = new ChildDTO();
					child2 = list.get(j);
					BigDecimal bda2= new BigDecimal("0");;
					List<String> liststr2 = new ArrayList<String>();
					liststr2=getTeamMaxSPList(child2.zqhhtzsp);
					int num2 = getTeamCount(child2.zqhhtzsp);
//					if(onlyHasSPFRQSPF){
//						bda2 = new BigDecimal(getTeamMaxSP(child2.zqhhtzsp));
//					}
					BigDecimal bdi2 = new BigDecimal(getTeamMinSP(child2.zqhhtzsp));
//					Log.e("getMatchCount", "jjjjjjjjj   bda2= " + bda2);
//					Log.e("getMatchCount", "jjjjjjjjj   bdi2= " + bdi2);
					c += num1 * num2;
//					if(onlyHasSPFRQSPF){
//						bdmaxM = bdmaxM.add(bda1.multiply(bda2));
//					}else{
//						for(int m=0;m<liststr1.size();m++){
//							bda1 = new BigDecimal(liststr1.get(m).toString());
//							for(int n=0;n<liststr2.size();n++){
//								bda2 = new BigDecimal(liststr2.get(n).toString());
//								bdmaxM = bdmaxM.add(bda1.multiply(bda2));
//							}
//						}
//					}
					for(int m=0;m<liststr1.size();m++){
						bda1 = new BigDecimal(liststr1.get(m).toString());
						for(int n=0;n<liststr2.size();n++){
							bda2 = new BigDecimal(liststr2.get(n).toString());
							bdmaxM = bdmaxM.add(bda1.multiply(bda2));
						}
					}
//					bdmaxM = bdmaxM.add(bda1.multiply(bda2));// maxM += max1 *
//																// max2;
					BigDecimal bdtemp = bdi1.multiply(bdi2);
					if (isFirst) {
						BigDecimal i0 = new BigDecimal(getTeamMinSP(list.get(0).zqhhtzsp));
						BigDecimal i1 = new BigDecimal(getTeamMinSP(list.get(1).zqhhtzsp));
						bdminM = i0.multiply(i1);
						isFirst = false;
					}
					if (bdtemp.compareTo(bdminM) == -1 || bdtemp.compareTo(bdminM) == 0) {
						bdminM = bdtemp;
					}
				}
			}
		} else if (num == 3) {
			boolean isFirst = true;
			for (int i = 0; i < list.size(); ++i) {
				ChildDTO child = new ChildDTO();
				child = list.get(i);
				int num1 = getTeamCount(child.zqhhtzsp);
				List<String> liststr1 = new ArrayList<String>();
				liststr1=getTeamMaxSPList(child.zqhhtzsp);
//				BigDecimal bda1 = new BigDecimal(getTeamMaxSP(child.zqhhtzsp()));
				BigDecimal bdi1 = new BigDecimal(getTeamMinSP(child.zqhhtzsp));
				for (int j = i + 1; j < list.size(); ++j) {
					ChildDTO child2 = new ChildDTO();
					child2 = list.get(j);
					int num2 = getTeamCount(child2.zqhhtzsp);
					List<String> liststr2 = new ArrayList<String>();
					liststr2=getTeamMaxSPList(child2.zqhhtzsp);
//					BigDecimal bda2 = new BigDecimal(getTeamMaxSP(child2.zqhhtzsp));
					BigDecimal bdi2 = new BigDecimal(getTeamMinSP(child2.zqhhtzsp));
					for (int k = j + 1; k < list.size(); ++k) {
						ChildDTO child3 = new ChildDTO();
						child3 = list.get(k);
						int num3 = getTeamCount(child3.zqhhtzsp);
						List<String> liststr3= new ArrayList<String>();
						liststr3=getTeamMaxSPList(child3.zqhhtzsp);
						
//						BigDecimal bda3 = new BigDecimal(getTeamMaxSP(child3.zqhhtzsp));
						BigDecimal bdi3 = new BigDecimal(getTeamMinSP(child3.zqhhtzsp));

						c += num1 * num2 * num3;
						for(int m=0;m<liststr1.size();m++){
//							int num1=listint221.get(m);
							BigDecimal bda1 = new BigDecimal(liststr1.get(m).toString());
							for(int n=0;n<liststr2.size();n++){
								BigDecimal bda2 = new BigDecimal(liststr2.get(n).toString());
								for(int z=0;z<liststr3.size();z++){
									BigDecimal bda3 = new BigDecimal(liststr3.get(z).toString());
									bdmaxM = bdmaxM.add(bda1.multiply(bda2).multiply(bda3));
								}
							}
						}
//						bdmaxM = bdmaxM.add(bda1.multiply(bda2).multiply(bda3));
						BigDecimal bdtemp = bdi1.multiply(bdi2).multiply(bdi3);
						if (isFirst) {
							BigDecimal i0 = new BigDecimal(getTeamMinSP(list.get(0).zqhhtzsp));
							BigDecimal i1 = new BigDecimal(getTeamMinSP(list.get(1).zqhhtzsp));
							BigDecimal i2 = new BigDecimal(getTeamMinSP(list.get(2).zqhhtzsp));
							bdminM = i0.multiply(i1).multiply(i2);
							isFirst = false;
						}
						if (bdtemp.compareTo(bdminM) == -1 || bdtemp.compareTo(bdminM) == 0) {
							bdminM = bdtemp;
						}
					}
				}
			}
		} else if (num == 4) {
			boolean isFirst = true;
			for (int i = 0; i < list.size(); ++i) {

				ChildDTO child = new ChildDTO();
				child = list.get(i);
				int num1 = getTeamCount(child.zqhhtzsp);
				List<String> liststr1 = new ArrayList<String>();
				liststr1=getTeamMaxSPList(child.zqhhtzsp);
//				BigDecimal bda1 = new BigDecimal(getTeamMaxSP(child.zqhhtzsp));
				BigDecimal bdi1 = new BigDecimal(getTeamMinSP(child.zqhhtzsp));
				for (int j = i + 1; j < list.size(); ++j) {
					ChildDTO child2 = new ChildDTO();
					child2 = list.get(j);
					int num2 = getTeamCount(child2.zqhhtzsp);
					List<String> liststr2 = new ArrayList<String>();
					liststr2=getTeamMaxSPList(child2.zqhhtzsp);
//					BigDecimal bda2 = new BigDecimal(getTeamMaxSP(child2.zqhhtzsp));
					BigDecimal bdi2 = new BigDecimal(getTeamMinSP(child2.zqhhtzsp));
					for (int k = j + 1; k < list.size(); ++k) {
						ChildDTO child3 = new ChildDTO();
						child3 = list.get(k);
						int num3 = getTeamCount(child3.zqhhtzsp);
						List<String> liststr3 = new ArrayList<String>();
						liststr3=getTeamMaxSPList(child3.zqhhtzsp);
//						BigDecimal bda3 = new BigDecimal(getTeamMaxSP(child3.zqhhtzsp));
						BigDecimal bdi3 = new BigDecimal(getTeamMinSP(child3.zqhhtzsp));
						for (int m = k + 1; m < list.size(); ++m) {
							ChildDTO child4 = new ChildDTO();
							child4 = list.get(m);
							int num4 = getTeamCount(child4.zqhhtzsp);
							List<String> liststr4 = new ArrayList<String>();
							liststr4=getTeamMaxSPList(child4.zqhhtzsp);
//							BigDecimal bda4 = new BigDecimal(getTeamMaxSP(child4.zqhhtzsp));
							BigDecimal bdi4 = new BigDecimal(getTeamMinSP(child4.zqhhtzsp));
							c += num1 * num2 * num3 * num4;
							for(int p=0;p<liststr1.size();p++){
//								int num1=listint221.get(m);
								BigDecimal bda1 = new BigDecimal(liststr1.get(p).toString());
								for(int n=0;n<liststr2.size();n++){
									BigDecimal bda2 = new BigDecimal(liststr2.get(n).toString());
									for(int z=0;z<liststr3.size();z++){
										BigDecimal bda3 = new BigDecimal(liststr3.get(z).toString());
										for(int x=0;x<liststr4.size();x++){
											BigDecimal bda4 = new BigDecimal(liststr4.get(x).toString());
											bdmaxM = bdmaxM.add(bda1.multiply(bda2).multiply(bda3).multiply(bda4));
										}
									}
								}
							}
							
							BigDecimal bdtemp = bdi1.multiply(bdi2).multiply(bdi3).multiply(bdi4);
							if (isFirst) {
								BigDecimal i0 = new BigDecimal(getTeamMinSP(list.get(0).zqhhtzsp));
								BigDecimal i1 = new BigDecimal(getTeamMinSP(list.get(1).zqhhtzsp));
								BigDecimal i2 = new BigDecimal(getTeamMinSP(list.get(2).zqhhtzsp));
								BigDecimal i3 = new BigDecimal(getTeamMinSP(list.get(3).zqhhtzsp));
								bdminM = i0.multiply(i1).multiply(i2).multiply(i3);
								isFirst = false;
							}
							if (bdtemp.compareTo(bdminM) == -1 || bdtemp.compareTo(bdminM) == 0) {
								bdminM = bdtemp;
							}
						}
					}
				}
			}
		}
		else if (num == 5) {
			boolean isFirst = true;
			for (int i = 0; i < list.size(); ++i) {

				ChildDTO child = new ChildDTO();
				child = list.get(i);
				int num1 = getTeamCount(child.zqhhtzsp);
				List<String> liststr1 = new ArrayList<String>();
				liststr1=getTeamMaxSPList(child.zqhhtzsp);
//				BigDecimal bda1 = new BigDecimal(getTeamMaxSP(child.zqhhtzsp));
				BigDecimal bdi1 = new BigDecimal(getTeamMinSP(child.zqhhtzsp));
				for (int j = i + 1; j < list.size(); ++j) {
					ChildDTO child2 = new ChildDTO();
					child2 = list.get(j);
					int num2 = getTeamCount(child2.zqhhtzsp);
					List<String> liststr2 = new ArrayList<String>();
					liststr2=getTeamMaxSPList(child2.zqhhtzsp);
//					BigDecimal bda2 = new BigDecimal(getTeamMaxSP(child2.zqhhtzsp));
					BigDecimal bdi2 = new BigDecimal(getTeamMinSP(child2.zqhhtzsp));
					for (int k = j + 1; k < list.size(); ++k) {
						ChildDTO child3 = new ChildDTO();
						child3 = list.get(k);
						int num3 = getTeamCount(child3.zqhhtzsp);
						List<String> liststr3 = new ArrayList<String>();
						liststr3=getTeamMaxSPList(child3.zqhhtzsp);
//						BigDecimal bda3 = new BigDecimal(getTeamMaxSP(child3.zqhhtzsp));
						BigDecimal bdi3 = new BigDecimal(getTeamMinSP(child3.zqhhtzsp));
						for (int m = k + 1; m < list.size(); ++m) {
							ChildDTO child4 = new ChildDTO();
							child4 = list.get(m);
							int num4 = getTeamCount(child4.zqhhtzsp);
							List<String> liststr4 = new ArrayList<String>();
							liststr4=getTeamMaxSPList(child4.zqhhtzsp);
//							BigDecimal bda4 = new BigDecimal(getTeamMaxSP(child4.zqhhtzsp));
							BigDecimal bdi4 = new BigDecimal(getTeamMinSP(child4.zqhhtzsp));
							for (int n = m + 1; n < list.size(); ++n) {
								ChildDTO child5 = new ChildDTO();
								child5 = list.get(n);
								int num5 = getTeamCount(child5.zqhhtzsp);
								List<String> liststr5 = new ArrayList<String>();
								liststr5=getTeamMaxSPList(child5.zqhhtzsp);
//								BigDecimal bda5 = new BigDecimal(getTeamMaxSP(child5.zqhhtzsp));
								BigDecimal bdi5 = new BigDecimal(getTeamMinSP(child5.zqhhtzsp));
								c += num1 * num2 * num3 * num4 * num5;
								for(int p=0;p<liststr1.size();p++){
//									int num1=listint221.get(m);
									BigDecimal bda1 = new BigDecimal(liststr1.get(p).toString());
									for(int a=0;a<liststr2.size();a++){
										BigDecimal bda2 = new BigDecimal(liststr2.get(a).toString());
										for(int z=0;z<liststr3.size();z++){
											BigDecimal bda3 = new BigDecimal(liststr3.get(z).toString());
											for(int x=0;x<liststr4.size();x++){
												BigDecimal bda4 = new BigDecimal(liststr4.get(x).toString());
												for(int y=0;y<liststr5.size();y++){
													BigDecimal bda5 = new BigDecimal(liststr5.get(y).toString());
													bdmaxM = bdmaxM.add(bda1.multiply(bda2).multiply(bda3).multiply(bda4).multiply(bda5));
												}
												
											}
										}
									}
								}
//								bdmaxM = bdmaxM.add(bda1.multiply(bda2).multiply(bda3).multiply(bda4).multiply(bda5));
								BigDecimal bdtemp = bdi1.multiply(bdi2).multiply(bdi3).multiply(bdi4).multiply(bdi5);
								if (isFirst) {
									BigDecimal i0 = new BigDecimal(getTeamMinSP(list.get(0).zqhhtzsp));
									BigDecimal i1 = new BigDecimal(getTeamMinSP(list.get(1).zqhhtzsp));
									BigDecimal i2 = new BigDecimal(getTeamMinSP(list.get(2).zqhhtzsp));
									BigDecimal i3 = new BigDecimal(getTeamMinSP(list.get(3).zqhhtzsp));
									BigDecimal i4 = new BigDecimal(getTeamMinSP(list.get(4).zqhhtzsp));
									bdminM = i0.multiply(i1).multiply(i2).multiply(i3).multiply(i4);
									isFirst = false;
								}
								if (bdtemp.compareTo(bdminM) == -1 || bdtemp.compareTo(bdminM) == 0) {
									bdminM = bdtemp;
								}
							}
						}
					}
				}
			}
		} else if (num == 6) {
			boolean isFirst = true;
			for (int i = 0; i < list.size(); ++i) {
				ChildDTO child = new ChildDTO();
				child = list.get(i);
				int num1 = getTeamCount(child.zqhhtzsp);
				List<String> liststr1 = new ArrayList<String>();
				liststr1=getTeamMaxSPList(child.zqhhtzsp);
//				BigDecimal bda1 = new BigDecimal(getTeamMaxSP(child.zqhhtzsp));
				BigDecimal bdi1 = new BigDecimal(getTeamMinSP(child.zqhhtzsp));
				for (int j = i + 1; j < list.size(); ++j) {
					ChildDTO child2 = new ChildDTO();
					child2 = list.get(j);
					int num2 = getTeamCount(child2.zqhhtzsp);
					List<String> liststr2 = new ArrayList<String>();
					liststr2=getTeamMaxSPList(child2.zqhhtzsp);
//					BigDecimal bda2 = new BigDecimal(getTeamMaxSP(child2.zqhhtzsp));
					BigDecimal bdi2 = new BigDecimal(getTeamMinSP(child2.zqhhtzsp));
					for (int k = j + 1; k < list.size(); ++k) {
						ChildDTO child3 = new ChildDTO();
						child3 = list.get(k);
						int num3 = getTeamCount(child3.zqhhtzsp);
						List<String> liststr3 = new ArrayList<String>();
						liststr3=getTeamMaxSPList(child3.zqhhtzsp);
//						BigDecimal bda3 = new BigDecimal(getTeamMaxSP(child3.zqhhtzsp));
						BigDecimal bdi3 = new BigDecimal(getTeamMinSP(child3.zqhhtzsp));
						for (int m = k + 1; m < list.size(); ++m) {
							ChildDTO child4 = new ChildDTO();
							child4 = list.get(m);
							int num4 = getTeamCount(child4.zqhhtzsp);
							List<String> liststr4 = new ArrayList<String>();
							liststr4=getTeamMaxSPList(child4.zqhhtzsp);
//							BigDecimal bda4 = new BigDecimal(getTeamMaxSP(child4.zqhhtzsp));
							BigDecimal bdi4 = new BigDecimal(getTeamMinSP(child4.zqhhtzsp));
							for (int n = m + 1; n < list.size(); ++n) {
								ChildDTO child5 = new ChildDTO();
								child5 = list.get(n);
								int num5 = getTeamCount(child5.zqhhtzsp);
								List<String> liststr5 = new ArrayList<String>();
								liststr5=getTeamMaxSPList(child5.zqhhtzsp);
//								BigDecimal bda5 = new BigDecimal(getTeamMaxSP(child5.zqhhtzsp));
								BigDecimal bdi5 = new BigDecimal(getTeamMinSP(child5.zqhhtzsp));
								for (int o = n + 1; o < list.size(); ++o) {
									ChildDTO child6 = new ChildDTO();
									child6 = list.get(o);
									int num6 = getTeamCount(child6.zqhhtzsp);
									List<String> liststr6 = new ArrayList<String>();
									liststr6=getTeamMaxSPList(child6.zqhhtzsp);
//									BigDecimal bda6 = new BigDecimal(getTeamMaxSP(child6.zqhhtzsp));
									BigDecimal bdi6 = new BigDecimal(getTeamMinSP(child6.zqhhtzsp));
									c += num1 * num2 * num3 * num4 * num5 * num6;
									for(int p=0;p<liststr1.size();p++){
//										int num1=listint221.get(m);
										BigDecimal bda1 = new BigDecimal(liststr1.get(p).toString());
										for(int a=0;a<liststr2.size();a++){
											BigDecimal bda2 = new BigDecimal(liststr2.get(a).toString());
											for(int z=0;z<liststr3.size();z++){
												BigDecimal bda3 = new BigDecimal(liststr3.get(z).toString());
												for(int x=0;x<liststr4.size();x++){
													BigDecimal bda4 = new BigDecimal(liststr4.get(x).toString());
													for(int y=0;y<liststr5.size();y++){
														BigDecimal bda5 = new BigDecimal(liststr5.get(y).toString());
														for(int r=0;r<liststr6.size();r++){
															BigDecimal bda6 = new BigDecimal(liststr6.get(r).toString());
															bdmaxM = bdmaxM.add(bda1.multiply(bda2).multiply(bda3).multiply(bda4).multiply(bda5).multiply(bda6));
														}
													}
												}
											}
										}
									}
//									bdmaxM = bdmaxM.add(bda1.multiply(bda2).multiply(bda3).multiply(bda4).multiply(bda5).multiply(bda6));
									BigDecimal bdtemp = bdi1.multiply(bdi2).multiply(bdi3).multiply(bdi4).multiply(bdi5).multiply(bdi6);
									if (isFirst) {
										BigDecimal i0 = new BigDecimal(getTeamMinSP(list.get(0).zqhhtzsp));
										BigDecimal i1 = new BigDecimal(getTeamMinSP(list.get(1).zqhhtzsp));
										BigDecimal i2 = new BigDecimal(getTeamMinSP(list.get(2).zqhhtzsp));
										BigDecimal i3 = new BigDecimal(getTeamMinSP(list.get(3).zqhhtzsp));
										BigDecimal i4 = new BigDecimal(getTeamMinSP(list.get(4).zqhhtzsp));
										BigDecimal i5 = new BigDecimal(getTeamMinSP(list.get(5).zqhhtzsp));
										bdminM = i0.multiply(i1).multiply(i2).multiply(i3).multiply(i4).multiply(i5);
										isFirst = false;
									}
									if (bdtemp.compareTo(bdminM) == -1 || bdtemp.compareTo(bdminM) == 0) {
										bdminM = bdtemp;
									}
								}
							}
						}
					}
				}
			}
		} else if (num == 7) {
			boolean isFirst = true;
			for (int i = 0; i < list.size(); ++i) {
				ChildDTO child = new ChildDTO();
				child = list.get(i);
				int num1 = getTeamCount(child.zqhhtzsp);
				List<String> liststr1 = new ArrayList<String>();
				liststr1=getTeamMaxSPList(child.zqhhtzsp);
//				BigDecimal bda1 = new BigDecimal(getTeamMaxSP(child.zqhhtzsp));
				BigDecimal bdi1 = new BigDecimal(getTeamMinSP(child.zqhhtzsp));
				for (int j = i + 1; j < list.size(); ++j) {
					ChildDTO child2 = new ChildDTO();
					child2 = list.get(j);
					int num2 = getTeamCount(child2.zqhhtzsp);
					List<String> liststr2 = new ArrayList<String>();
					liststr2=getTeamMaxSPList(child2.zqhhtzsp);
//					BigDecimal bda2 = new BigDecimal(getTeamMaxSP(child2.zqhhtzsp));
					BigDecimal bdi2 = new BigDecimal(getTeamMinSP(child2.zqhhtzsp));
					for (int k = j + 1; k < list.size(); ++k) {
						ChildDTO child3 = new ChildDTO();
						child3 = list.get(k);
						int num3 = getTeamCount(child3.zqhhtzsp);
						List<String> liststr3 = new ArrayList<String>();
						liststr3=getTeamMaxSPList(child3.zqhhtzsp);
//						BigDecimal bda3 = new BigDecimal(getTeamMaxSP(child3.zqhhtzsp));
						BigDecimal bdi3 = new BigDecimal(getTeamMinSP(child3.zqhhtzsp));
						for (int m = k + 1; m < list.size(); ++m) {
							ChildDTO child4 = new ChildDTO();
							child4 = list.get(m);
							int num4 = getTeamCount(child4.zqhhtzsp);
							List<String> liststr4 = new ArrayList<String>();
							liststr4=getTeamMaxSPList(child4.zqhhtzsp);
//							BigDecimal bda4 = new BigDecimal(getTeamMaxSP(child4.zqhhtzsp));
							BigDecimal bdi4 = new BigDecimal(getTeamMinSP(child4.zqhhtzsp));
							for (int n = m + 1; n < list.size(); ++n) {
								ChildDTO child5 = new ChildDTO();
								child5 = list.get(n);
								int num5 = getTeamCount(child5.zqhhtzsp);
								List<String> liststr5 = new ArrayList<String>();
								liststr5=getTeamMaxSPList(child5.zqhhtzsp);
//								BigDecimal bda5 = new BigDecimal(getTeamMaxSP(child5.zqhhtzsp));
								BigDecimal bdi5 = new BigDecimal(getTeamMinSP(child5.zqhhtzsp));
								for (int o = n + 1; o < list.size(); ++o) {
									ChildDTO child6 = new ChildDTO();
									child6 = list.get(o);
									int num6 = getTeamCount(child6.zqhhtzsp);
									List<String> liststr6 = new ArrayList<String>();
									liststr6=getTeamMaxSPList(child6.zqhhtzsp);
//									BigDecimal bda6 = new BigDecimal(getTeamMaxSP(child6.zqhhtzsp));
									BigDecimal bdi6 = new BigDecimal(getTeamMinSP(child6.zqhhtzsp));
									for (int p = o + 1; p < list.size(); ++p) {
										ChildDTO child7 = new ChildDTO();
										child7 = list.get(p);
										int num7 = getTeamCount(child7.zqhhtzsp);
										List<String> liststr7 = new ArrayList<String>();
										liststr7=getTeamMaxSPList(child7.zqhhtzsp);
//										BigDecimal bda7 = new BigDecimal(getTeamMaxSP(child7.zqhhtzsp));
										BigDecimal bdi7 = new BigDecimal(getTeamMinSP(child7.zqhhtzsp));
										c += num1 * num2 * num3 * num4 * num5 * num6 * num7;
										for(int w=0;w<liststr1.size();w++){
//											int num1=listint221.get(m);
											BigDecimal bda1 = new BigDecimal(liststr1.get(w).toString());
											for(int a=0;a<liststr2.size();a++){
												BigDecimal bda2 = new BigDecimal(liststr2.get(a).toString());
												for(int z=0;z<liststr3.size();z++){
													BigDecimal bda3 = new BigDecimal(liststr3.get(z).toString());
													for(int x=0;x<liststr4.size();x++){
														BigDecimal bda4 = new BigDecimal(liststr4.get(x).toString());
														for(int y=0;y<liststr5.size();y++){
															BigDecimal bda5 = new BigDecimal(liststr5.get(y).toString());
															for(int r=0;r<liststr6.size();r++){
																BigDecimal bda6 = new BigDecimal(liststr6.get(r).toString());
																for(int t=0;t<liststr7.size();t++){
																	BigDecimal bda7 = new BigDecimal(liststr7.get(t).toString());
																	bdmaxM = bdmaxM.add(bda1.multiply(bda2).multiply(bda3).multiply(bda4).multiply(bda5).multiply(bda6).multiply(bda7));
																}
															}
														}
													}
												}
											}
										}
//										bdmaxM = bdmaxM.add(bda1.multiply(bda2).multiply(bda3).multiply(bda4).multiply(bda5).multiply(bda6).multiply(bda7));
										BigDecimal bdtemp = bdi1.multiply(bdi2).multiply(bdi3).multiply(bdi4).multiply(bdi5).multiply(bdi6).multiply(bdi7);
										if (isFirst) {
											BigDecimal i0 = new BigDecimal(getTeamMinSP(list.get(0).zqhhtzsp));
											BigDecimal i1 = new BigDecimal(getTeamMinSP(list.get(1).zqhhtzsp));
											BigDecimal i2 = new BigDecimal(getTeamMinSP(list.get(2).zqhhtzsp));
											BigDecimal i3 = new BigDecimal(getTeamMinSP(list.get(3).zqhhtzsp));
											BigDecimal i4 = new BigDecimal(getTeamMinSP(list.get(4).zqhhtzsp));
											BigDecimal i5 = new BigDecimal(getTeamMinSP(list.get(5).zqhhtzsp));
											BigDecimal i6 = new BigDecimal(getTeamMinSP(list.get(6).zqhhtzsp));
											bdminM = i0.multiply(i1).multiply(i2).multiply(i3).multiply(i4).multiply(i5).multiply(i6);
											isFirst = false;
										}
										if (bdtemp.compareTo(bdminM) == -1 || bdtemp.compareTo(bdminM) == 0) {
											bdminM = bdtemp;
										}
									}
								}
							}
						}
					}
				}
			}
		} else if (num == 8) {
			boolean isFirst = true;
			for (int i = 0; i < list.size(); ++i) {
				ChildDTO child = new ChildDTO();
				child = list.get(i);
				int num1 = getTeamCount(child.zqhhtzsp);
				List<String> liststr1 = new ArrayList<String>();
				liststr1=getTeamMaxSPList(child.zqhhtzsp);
//				BigDecimal bda1 = new BigDecimal(getTeamMaxSP(child.zqhhtzsp));
				BigDecimal bdi1 = new BigDecimal(getTeamMinSP(child.zqhhtzsp));
				for (int j = i + 1; j < list.size(); ++j) {
					ChildDTO child2 = new ChildDTO();
					child2 = list.get(j);
					int num2 = getTeamCount(child2.zqhhtzsp);
					List<String> liststr2 = new ArrayList<String>();
					liststr2=getTeamMaxSPList(child2.zqhhtzsp);
//					BigDecimal bda2 = new BigDecimal(getTeamMaxSP(child2.zqhhtzsp));
					BigDecimal bdi2 = new BigDecimal(getTeamMinSP(child2.zqhhtzsp));
					for (int k = j + 1; k < list.size(); ++k) {
						ChildDTO child3 = new ChildDTO();
						child3 = list.get(k);
						int num3 = getTeamCount(child3.zqhhtzsp);
						List<String> liststr3 = new ArrayList<String>();
						liststr3=getTeamMaxSPList(child3.zqhhtzsp);
//						BigDecimal bda3 = new BigDecimal(getTeamMaxSP(child3.zqhhtzsp));
						BigDecimal bdi3 = new BigDecimal(getTeamMinSP(child3.zqhhtzsp));
						for (int m = k + 1; m < list.size(); ++m) {
							ChildDTO child4 = new ChildDTO();
							child4 = list.get(m);
							int num4 = getTeamCount(child4.zqhhtzsp);
							List<String> liststr4 = new ArrayList<String>();
							liststr4=getTeamMaxSPList(child4.zqhhtzsp);
//							BigDecimal bda4 = new BigDecimal(getTeamMaxSP(child4.zqhhtzsp));
							BigDecimal bdi4 = new BigDecimal(getTeamMinSP(child4.zqhhtzsp));
							for (int n = m + 1; n < list.size(); ++n) {
								ChildDTO child5 = new ChildDTO();
								child5 = list.get(n);
								int num5 = getTeamCount(child5.zqhhtzsp);
								List<String> liststr5 = new ArrayList<String>();
								liststr5=getTeamMaxSPList(child5.zqhhtzsp);
//								BigDecimal bda5 = new BigDecimal(getTeamMaxSP(child5.zqhhtzsp));
								BigDecimal bdi5 = new BigDecimal(getTeamMinSP(child5.zqhhtzsp));
								for (int o = n + 1; o < list.size(); ++o) {
									ChildDTO child6 = new ChildDTO();
									child6 = list.get(o);
									int num6 = getTeamCount(child6.zqhhtzsp);
									List<String> liststr6 = new ArrayList<String>();
									liststr6=getTeamMaxSPList(child6.zqhhtzsp);
//									BigDecimal bda6 = new BigDecimal(getTeamMaxSP(child6.zqhhtzsp));
									BigDecimal bdi6 = new BigDecimal(getTeamMinSP(child6.zqhhtzsp));
									for (int p = o + 1; p < list.size(); ++p) {
										ChildDTO child7 = new ChildDTO();
										child7 = list.get(p);
										int num7 = getTeamCount(child7.zqhhtzsp);
										List<String> liststr7 = new ArrayList<String>();
										liststr7=getTeamMaxSPList(child7.zqhhtzsp);
//										BigDecimal bda7 = new BigDecimal(getTeamMaxSP(child7.zqhhtzsp));
										BigDecimal bdi7 = new BigDecimal(getTeamMinSP(child7.zqhhtzsp));
										for (int q = p + 1; q < list.size(); ++q) {
											ChildDTO child8 = new ChildDTO();
											child8 = list.get(q);
											int num8 = getTeamCount(child8.zqhhtzsp);
											List<String> liststr8 = new ArrayList<String>();
											liststr8=getTeamMaxSPList(child8.zqhhtzsp);
//											BigDecimal bda8 = new BigDecimal(getTeamMaxSP(child8.zqhhtzsp));
											BigDecimal bdi8 = new BigDecimal(getTeamMinSP(child8.zqhhtzsp));
											c += num1 * num2 * num3 * num4 * num5 * num6 * num7 * num8;
											for(int w=0;w<liststr1.size();w++){
//												int num1=listint221.get(m);
												BigDecimal bda1 = new BigDecimal(liststr1.get(w).toString());
												for(int a=0;a<liststr2.size();a++){
													BigDecimal bda2 = new BigDecimal(liststr2.get(a).toString());
													for(int z=0;z<liststr3.size();z++){
														BigDecimal bda3 = new BigDecimal(liststr3.get(z).toString());
														for(int x=0;x<liststr4.size();x++){
															BigDecimal bda4 = new BigDecimal(liststr4.get(x).toString());
															for(int y=0;y<liststr5.size();y++){
																BigDecimal bda5 = new BigDecimal(liststr5.get(y).toString());
																for(int r=0;r<liststr6.size();r++){
																	BigDecimal bda6 = new BigDecimal(liststr6.get(r).toString());
																	for(int t=0;t<liststr7.size();t++){
																		BigDecimal bda7 = new BigDecimal(liststr7.get(t).toString());
																		for(int u=0;u<liststr8.size();u++){
																			BigDecimal bda8 = new BigDecimal(liststr8.get(u).toString());
																			bdmaxM = bdmaxM.add(bda1.multiply(bda2).multiply(bda3).multiply(bda4).multiply(bda5).multiply(bda6).multiply(bda7).multiply(bda8));
																		}
																	}
																}
															}
														}
													}
												}
											}
//											bdmaxM = bdmaxM.add(bda1.multiply(bda2).multiply(bda3).multiply(bda4).multiply(bda5).multiply(bda6).multiply(bda7).multiply(bda8));
											BigDecimal bdtemp = bdi1.multiply(bdi2).multiply(bdi3).multiply(bdi4).multiply(bdi5).multiply(bdi6).multiply(bdi7).multiply(bdi8);
											if (isFirst) {
												BigDecimal i0 = new BigDecimal(getTeamMinSP(list.get(0).zqhhtzsp));
												BigDecimal i1 = new BigDecimal(getTeamMinSP(list.get(1).zqhhtzsp));
												BigDecimal i2 = new BigDecimal(getTeamMinSP(list.get(2).zqhhtzsp));
												BigDecimal i3 = new BigDecimal(getTeamMinSP(list.get(3).zqhhtzsp));
												BigDecimal i4 = new BigDecimal(getTeamMinSP(list.get(4).zqhhtzsp));
												BigDecimal i5 = new BigDecimal(getTeamMinSP(list.get(5).zqhhtzsp));
												BigDecimal i6 = new BigDecimal(getTeamMinSP(list.get(6).zqhhtzsp));
												BigDecimal i7 = new BigDecimal(getTeamMinSP(list.get(7).zqhhtzsp));
												bdminM = i0.multiply(i1).multiply(i2).multiply(i3).multiply(i4).multiply(i5).multiply(i6).multiply(i7);
												isFirst = false;
											}
											if (bdtemp.compareTo(bdminM) == -1 || bdtemp.compareTo(bdminM) == 0) {
												bdminM = bdtemp;
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
		result = c + "|" + bdminM + "|" + bdmaxM;
		Log.d("JczqHHMoneyForecastUtil ", "getMatchCount result= " + result);
		return result;

	}

}
